package com.woniu.apiImpl;

import com.woniu.api.HisPrescriptionQueryApi;
import com.woniu.dto.HisPrescriptionDto;
import com.woniu.dto.PageDTO;
import com.woniu.mapper.HisPrescriptionMapper;
import com.woniu.param.AddByIdHisPrescriptionParam;
import com.woniu.param.AddHisPrescriptionParam;
import com.woniu.param.ListHisPrescriptionParam;
import com.woniu.param.ModifyHisPrescriptionParam;
import com.woniu.service.HisPrescriptionService;
import com.woniu.util.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
public class HisPrescriptionQueryApiImpl implements HisPrescriptionQueryApi {
    @Resource
    private HisPrescriptionService hisPrescriptionService;
    @Override
    public Result<List<HisPrescriptionDto>> newDrugs(AddByIdHisPrescriptionParam addByIdHisPrescriptionParam) {
        List<HisPrescriptionDto> hisPrescriptionDtos = hisPrescriptionService.newDrugs(addByIdHisPrescriptionParam);
        return Result.bulid(hisPrescriptionDtos);
    }

    @Override
    public Result<Boolean> deleteMedication(ArrayList<Integer> id) {
        Boolean aBoolean = hisPrescriptionService.deleteMedication(id);
        return Result.bulid(aBoolean);
    }

    @Override
    public Result<Boolean> modifyMedication(ModifyHisPrescriptionParam modifyHisPrescriptionParam) {
        Boolean aBoolean = hisPrescriptionService.modifyPayment(modifyHisPrescriptionParam);
        return Result.bulid(aBoolean);
    }

    @Override
    public Result<Boolean> receivingMedicine(ModifyHisPrescriptionParam modifyHisPrescriptionParam) {
        Boolean aBoolean = hisPrescriptionService.modifyState(modifyHisPrescriptionParam);
        return Result.bulid(aBoolean);
    }

    @Override
    public Result<PageDTO<HisPrescriptionDto>> queryMedication(ListHisPrescriptionParam listHisPrescriptionParam) {
        PageDTO pageDTO = hisPrescriptionService.queryMedication(listHisPrescriptionParam);
        return Result.bulid(pageDTO);
    }
}
